package com.hnkywl.sts.action.cwgl;

import com.hnkywl.sts.service.cwgl.GrjkService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-6-4
 * Time: 上午9:49
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/grjk")
public class GrjkAction extends SimpleActionSupport{
    private GrjkService grjkService;

    private Long gsId;
    private Long gsjgId;
    private Long ygId;
    private Date endDate;

    @Action("grjkList")
    public void grjkList(){
        renderJson(grjkService.findAll(endDate,gsId,gsjgId,ygId));
    }

    @Action("grjkMxList")
    public void grjkMxList(){
        renderJson(grjkService.findMx(ygId));
    }

    @Action("grjk_mx")
    public String grjkMx(){
        return SUCCESS;
    }

    @Action("grjk")
    public String grjk(){
         endDate = new Date();
        return SUCCESS;
    }

    //==========getter setter========

    public Long getGsId() {
        return gsId;
    }

    public void setGsId(Long gsId) {
        this.gsId = gsId;
    }

    public Long getGsjgId() {
        return gsjgId;
    }

    public void setGsjgId(Long gsjgId) {
        this.gsjgId = gsjgId;
    }

    public Long getYgId() {
        return ygId;
    }

    public void setYgId(Long ygId) {
        this.ygId = ygId;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    //========setter========
    @Autowired
    public void setGrjkService(GrjkService grjkService) {
        this.grjkService = grjkService;
    }
}
